#include"stdafx.h"
#include "UserData.h"
#include <iostream>
#include <string>
#include <fstream>
using namespace std;

bool UserData::NewUser(string username,string password,int total_budget)
{
 User newuser;
 newuser.SetDetail(username,password,total_budget);
 ofstream writeFile("users.txt",ios::app,0);
 writeFile<<newuser;
 writeFile.close();
 return true;
}
bool UserData::FindUser(string username,string password)
{
 ifstream readFile("users.txt");
 User pick;
 while(readFile>>pick)
 {
   if((pick.username==username)&&(pick.password==password))
 {
   readFile.close();
   return ture;
 }
 }
  readFile.close();
 return false;
}
